public class Demo7 {
    public static void main(String[] args) {
        Object locker = new Object();

        Thread thread = new Thread(() -> {
            synchronized(locker) {
                try {
                    locker.wait(5000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println(Thread.currentThread().getName());
            }
        });

        thread.start();

    }
}
